/*
 * 订单类型下拉列表
 * 参数   交易码：trancode=OrderType
 * 
 */

package org.ccams.tran;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.ccams.domain.TOrdertype;
/**
 * 订单类型下拉列表
 * @author Administrator
 *
 */
public class TranOrderType extends AbstractJsonTran {

	@SuppressWarnings("unchecked")
	public void buildJSONObject(Map model, JSONObject json,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HashMap<String, Object> jsonMap = new HashMap<String, Object>();
		ArrayList<TOrdertype> al = new ArrayList<TOrdertype>();
		List<TOrdertype> list = getCcamsService().getTordertypeDao().getAll();
		for(TOrdertype t : list){
			TOrdertype tm = new TOrdertype();
			tm.setIdtOrdertype(t.getIdtOrdertype());
			tm.setOrdername(t.getOrdername());
			al.add(tm);
		}
		JSONArray JsonArray = JSONArray.fromObject(al); //得到JSON数组 
        jsonMap.put("root", JsonArray);
        json.putAll(jsonMap);
	}
}
